10 HOME
20 PRINT CHR$(4);"PR#3"
21 GOSUB 20000
22 HOME
23 DIM B(20,80)
24 DIM C(1600)


26 X1=10:Y1=42:X9=10:Y9=40:V8=10:V9=38:BB=0:LL=0:O1=0:C6=0:G1=0:MA=0

27 FOR I=1 TO 8
28 M(I)=I
29 NEXT I


33 ONERR GOTO 34

34 HOME:INVERSE:VTAB 23:HTAB 1:PRINT" PLEASE INSERT A DATA DISK IN SLOT 6 DRIVE 2,THEN PRESS <SPC> TO BE CONTINUE. ":VTAB 23:HTAB 79:GET G$:VTAB 23:HTAB 79:PRINT G$:NORMAL

35 IF G$<>" " THEN 34

36 NORMAL:D2=1:GOSUB 15800


39 NORMAL:HOME:ONERR GOTO 22200

42 T$="R  DR  D  DL  L  UL  U  UR "

44 VTAB 10:HTAB 40:PRINT " "
45 VTAB 10:HTAB 40:PRINT "M"
50 INVERSE:VTAB 10:HTAB 42:PRINT "$":NORMAL
52 VTAB 20:HTAB 6:PRINT"Y":VTAB 20:HTAB 10:PRINT"I":VTAB 20:HTAB 15:PRINT"R - RUN":VTAB 20:HTAB 25:PRINT"S - SAVE MAZE":VTAB 20:HTAB 66:PRINT"DOLLAR :    0"
54 VTAB 21 :HTAB 5:PRINT"G H":VTAB 21:HTAB 9:PRINT"J K":VTAB 21:HTAB 25:PRINT"L - LOAD MAZE":VTAB 21:HTAB 42:PRINT"X - CATALOG":VTAB 21:HTAB 55:PRINT"O - HELP":VTAB 21:HTAB 66:PRINT"  STEP :    0"
56 VTAB 22 :HTAB 6:PRINT"B":VTAB 22:HTAB 10:PRINT"M":VTAB 22:HTAB 15:PRINT"Q - QUIT":VTAB 22:HTAB 25:PRINT"C - CLEAR SCN":VTAB 22:HTAB 42:PRINT"U - CLEAR ROUTE":VTAB 22:HTAB 66:PRINT"RESTEP :    0"

58 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                               ":NORMAL

59 GOSUB 1200

60 NO=0:R1=0

61 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

62 IF V8=10 AND V9=38 AND G1=0 THEN 64

63 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL:VTAB V8:HTAB V9:PRINT"T"

64 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

65 IF A$="Q" THEN 9000


74 IF A$=CHR$(25) THEN X2=X1-1:Y2=Y1:GOSUB 62000
75 IF A$=CHR$(7) THEN X2=X1:Y2=Y1-1:GOSUB 62000
76 IF A$=CHR$(8) THEN X2=X1:Y2=Y1+1:GOSUB 62000
77 IF A$=CHR$(2) THEN X2=X1+1:Y2=Y1:GOSUB 62000

78 IF A$="I" THEN X2=X1-1:Y2=Y1:GOSUB 62100
80 IF A$="J" THEN X2=X1:Y2=Y1-1:GOSUB 62100
90 IF A$="K" THEN X2=X1:Y2=Y1+1:GOSUB 62100
95 IF A$="M" THEN X2=X1+1:Y2=Y1:GOSUB 62100

100 IF A$="Y" THEN X2=X1-1:Y2=Y1:GOSUB 62200
110 IF A$="G" THEN X2=X1:Y2=Y1-1:GOSUB 62200
120 IF A$="H" THEN X2=X1:Y2=Y1+1:GOSUB 62200
130 IF A$="B" THEN X2=X1+1:Y2=Y1:GOSUB 62200

160 IF A$="R" THEN 300
170 IF A$="S" THEN 15000
180 IF A$="L" THEN 15100
182 IF A$="C" THEN 15500
184 IF A$="X" THEN 15800
186 IF A$="O" THEN 18000
188 IF A$="U" THEN VTAB 20:HTAB 44:PRINT"                      ":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL:GOSUB 21000

191 IF A$=CHR$(6) THEN 33000
193 IF A$=CHR$(26) THEN C6=0:NORMAL:VTAB 21:HTAB 15:PRINT"        ":GOTO 43000


197 IF A$=CHR$(20) THEN 34000
198 IF A$=CHR$(15) THEN 30000

199 IF A$=CHR$(18) THEN G1=0:GOTO 41000


200 GOTO 60

300 X4=X9:Y4=Y9:I1=1:S1=0:H2=0
305 VTAB 20:HTAB 44:PRINT"                ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL
307 GOSUB 26000

308 IF G1>0 THEN NORMAL:VTAB V8:HTAB V9:PRINT"T"


310 IF B(X9,Y9)=1 THEN B(X9,Y9)=0:VTAB X9:HTAB Y9:PRINT"M":BB=BB-1:GOSUB 1200

312 IF B(V8,V9)=1 AND G1>0 THEN B(V8,V9)=0:VTAB V8:HTAB V9:PRINT"T":BB=BB-1:GOSUB 1200 

314 IF B(X9,Y9+1)=1 AND B(X9+1,Y9+1)=1 AND B(X9+1,Y9)=1 AND B(X9+1,Y9-1)=1 AND B(X9,Y9-1)=1 AND B(X9-1,Y9-1)=1 AND B(X9-1,Y9)=1 AND B(X9-1,Y9+1)=1 THEN INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 60

315 VTAB X4:HTAB Y4:PRINT"M"

317 IF PEEK(-16384)=155 THEN NORMAL:VTAB X4:HTAB Y4:PRINT" ":POKE -16384+16,0:EC=1 :GOTO 650

320 X5=X4:Y5=Y4

325 FOR I8=1 TO 8


330 IF G1>0 AND M(I8)=4 THEN 7600
331 IF G1>0 AND M(I8)=3 THEN 7610
332 IF G1>0 AND M(I8)=2 THEN 7620
333 IF G1>0 AND M(I8)=1 THEN 7630
334 IF G1>0 AND M(I8)=8 THEN 7640
335 IF G1>0 AND M(I8)=7 THEN 7650
336 IF G1>0 AND M(I8)=6 THEN 7660
337 IF G1>0 AND M(I8)=5 THEN 7670

338 IF G1=0 AND M(I8)=4 AND B(X4+1,Y4-1)=0 THEN XX=X4+1:YY=Y4-1:Q=5:F1=1:GOTO 530
340 IF G1=0 AND M(I8)=3 AND B(X4+1,Y4)=0 THEN XX=X4+1:YY=Y4:Q=4:F1=2:GOTO 530
350 IF G1=0 AND M(I8)=2 AND B(X4+1,Y4+1)=0 THEN XX=X4+1:YY=Y4+1:Q=6:F1=3:GOTO 530
360 IF G1=0 AND M(I8)=1 AND B(X4,Y4+1)=0 THEN XX=X4:YY=Y4+1:Q=3:F1=4:GOTO 530
370 IF G1=0 AND M(I8)=8 AND B(X4-1,Y4+1)=0 THEN XX=X4-1:YY=Y4+1:Q=7:F1=5:GOTO 530
380 IF G1=0 AND M(I8)=7 AND B(X4-1,Y4)=0 THEN XX=X4-1:YY=Y4:Q=2:F1=6:GOTO 530
390 IF G1=0 AND M(I8)=6 AND B(X4-1,Y4-1)=0 THEN XX=X4-1:YY=Y4-1:Q=8:F1=7:GOTO 530
395 IF G1=0 AND M(I8)=5 AND B(X4,Y4-1)=0 THEN XX=X4:YY=Y4-1:Q=1:F1=8:GOTO 530

398 NEXT I8

400 I1=I1-1:IF I1<1 THEN I1=1
410 A7=C(I1):C(I1)=23:H2=H2+1:N1=22:N2=78:GOSUB 900
420 IF A7=1 THEN YY=Y4+1:XX=X4
430 IF A7=4 THEN XX=X4-1:YY=Y4
440 IF A7=3 THEN YY=Y4-1:XX=X4
450 IF A7=2 THEN XX=X4+1:YY=Y4
460 IF A7=5 THEN XX=X4-1:YY=Y4+1
470 IF A7=6 THEN XX=X4-1:YY=Y4-1
480 IF A7=7 THEN XX=X4+1:YY=Y4-1
490 IF A7=8 THEN XX=X4+1:YY=Y4+1
500 GOTO 550
530 IF B(XX,YY)=2 THEN XX=X4:YY=Y4:ON F1 GOTO 340,350,360,370,380,390,395,400
540 C(I1)=Q:I1=I1+1
550 GOSUB 7000:VTAB X4:HTAB Y4:PRINT" ":B(XX,YY)=2 

552 IF G1>0 AND XX=V8 AND YY=V9 THEN GOSUB 7000:VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650
554 IF G1>0 AND (XX>19 OR XX<1 OR YY>79 OR YY<1) THEN GOSUB 7500

560 IF XX>19 OR XX<1 OR YY>79 OR YY<1 THEN GOSUB 7000:VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650
570 X4=XX:Y4=YY:GOSUB 7000:VTAB X4:HTAB Y4:PRINT"M":VTAB X5:HTAB Y5:PRINT" "
575 IF XX=X9 AND YY=Y9 THEN R1=R1+1:GOSUB 28000
577 IF R1>8 THEN R1=0:NO=1:INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 650
580 S1=S1+1:N1=21:N2=78
590 IF S1>9 THEN N2=N2-1
600 IF S1>99 THEN N2=N2-1
610 IF S1>999 THEN N2=N2-1
620 VTAB N1:HTAB N2: PRINT S1
640 GOTO 315

650 INVERSE:VTAB 23:HTAB 1:PRINT"              WAITING                       ":NORMAL
660 FOR I=0 TO 20
670 FOR J=0 TO 80
680 IF B(I,J)<>1 THEN B(I,J)=0
690 NEXT J
700 NEXT I
705 INVERSE:VTAB 23:HTAB 15:PRINT"        ":NORMAL
710 IF NO=1 OR EC=1 THEN NO=0:EC=0:GOTO 60
720 INVERSE:VTAB 20:HTAB 44:PRINT"SHORTCUT":NORMAL
730 X7=X9:Y7=Y9:I2=1:CUT=0
740 IF C(I2)=5 THEN X8=X7+1:Y8=Y7-1
750 IF C(I2)=4 THEN X8=X7+1:Y8=Y7
760 IF C(I2)=6 THEN X8=X7+1:Y8=Y7+1
770 IF C(I2)=3 THEN X8=X7:Y8=Y7+1
780 IF C(I2)=7 THEN X8=X7-1:Y8=Y7+1
790 IF C(I2)=2 THEN X8=X7-1:Y8=Y7
792 IF C(I2)=8 THEN X8=X7-1:Y8=Y7-1 
794 IF C(I2)=1 THEN X8=X7:Y8=Y7-1

795 IF G1>0 AND X8=V8 AND Y8=V9 THEN GOSUB 7000:INVERSE:VTAB X7:HTAB Y7:PRINT" ":NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:GOTO 60

796 IF G1>0 AND (X8>19 OR X8<1 OR Y8>79 OR Y8<1) THEN GOSUB 7000

798 IF X8>19 OR X8<1 OR Y8>79 OR Y8<1 THEN GOSUB 7000:INVERSE:VTAB X7:HTAB Y7:PRINT" ":NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:GOTO 60

800 GOSUB 7000:VTAB X8:HTAB Y8:PRINT"M":VTAB X7:HTAB Y7:INVERSE:PRINT" "::NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:X7=X8:Y7=Y8

810 I2=I2+1
880 GOTO 740

900 IF H2>9 THEN N2=N2-1
910 IF H2>99 THEN N2=N2-1
920 IF H2>999 THEN N2=N2-1
930 VTAB N1:HTAB N2: PRINT H2
940 RETURN

1000 IF X2<1 THEN X2=19
1010 IF X2>19 THEN X2=1
1020 IF Y2<1 THEN Y2=79
1030 IF Y2>79 THEN Y2=1

1040 RETURN

1100 IF B(X1,Y1)=0 THEN BB=BB+1
1110 RETURN 

1150 IF B(X1,Y1)=1 THEN BB=BB-1
1160 RETURN

1200 IF BB<0 THEN BB=0
1210 IF BB<10 AND BB>-1 THEN NN1=78
1220 IF BB<100 AND BB>9 THEN NN1=77
1230 IF BB<1000 AND BB>99 THEN NN1=76
1240 IF BB<10000 AND BB>999 THEN NN1=75
1250 VTAB 20:HTAB 75:PRINT"    "
1260 VTAB 20:HTAB NN1:PRINT BB
1270 RETURN


7000 IF X4<1 THEN X4=19
7010 IF X4>19 THEN X4=1
7020 IF Y4<1 THEN Y4=79
7030 IF Y4>79 THEN Y4=1


7100 IF X5<1 THEN X5=19
7110 IF X5>19 THEN X5=1
7120 IF Y5<1 THEN Y5=79
7130 IF Y5>79 THEN Y5=1

7200 IF X7<1 THEN X7=19
7210 IF X7>19 THEN X7=1
7220 IF Y7<1 THEN Y7=79
7230 IF Y7>79 THEN Y7=1


7300 IF X8<1 THEN X8=19
7310 IF X8>19 THEN X8=1
7320 IF Y8<1 THEN Y8=79
7330 IF Y8>79 THEN Y8=1


7390 RETURN


7500 IF XX<1 THEN XX=19
7510 IF XX>19 THEN XX=1
7520 IF YY<1 THEN YY=79
7530 IF YY>79 THEN YY=1


7590 RETURN


7600 XX=X4+1:YY=Y4-1
7602 GOSUB 7500
7604 IF B(XX,YY)=0 THEN Q=5:F1=1:GOTO 530
7606 GOTO 331

7610 XX=X4+1:YY=Y4
7612 GOSUB 7500
7614 IF B(XX,YY)=0 THEN Q=4:F1=2:GOTO 530
7616 GOTO 332
 

7620 XX=X4+1:YY=Y4+1
7622 GOSUB 7500
7624 IF B(XX,YY)=0 THEN Q=6:F1=3:GOTO 530
7626 GOTO 333

7630 XX=X4:YY=Y4+1
7632 GOSUB 7500
7634 IF B(XX,YY)=0 THEN Q=3:F1=4:GOTO 530
7636 GOTO 334

7640 XX=X4-1:YY=Y4+1
7642 GOSUB 7500
7644 IF B(XX,YY)=0 THEN Q=7:F1=5:GOTO 530
7646 GOTO 335

7650 XX=X4-1:YY=Y4
7652 GOSUB 7500
7654 IF B(XX,YY)=0 THEN Q=2:F1=6:GOTO 530
7656 GOTO 336

7660 XX=X4-1:YY=Y4-1
7662 GOSUB 7500
7664 IF B(XX,YY)=0 THEN Q=8:F1=7:GOTO 530
7666 GOTO 337

7670 XX=X4:YY=Y4-1
7672 GOSUB 7500
7674 IF B(XX,YY)=0 THEN Q=1:F1=8:GOTO 530
7676 GOTO 338


9000 HOME:PRINT CHR$(4);"CATALOG"+",D1,S6":END


15000 INVERSE:VTAB 23:HTAB 1:PRINT"                                                 ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL

15005 INVERSE:VTAB 23:HTAB 50:PRINT"SAVING":NORMAL
15007 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60

15009 IF LEN(F$) > 24 THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 15000

15010 REM

15012 PRINT CHR$(4);"OPEN";F$
15020 PRINT CHR$(4);"WRITE";F$ 
15030 FOR I=1 TO 19
15040 FOR J=1 TO 79
15050 PRINT B(I,J)
15060 NEXT J
15070 NEXT I
15080 PRINT CHR$(4);"CLOSE";F$

15081 PRINT CHR$(4);"OPEN";F$+".INDEX"
15082 PRINT CHR$(4);"WRITE";F$+".INDEX"
15083 PRINT X1:PRINT Y1:PRINT X9:PRINT Y9:PRINT V8:PRINT V9:PRINT G1:PRINT M(1):PRINT M(2):PRINT M(3):PRINT M(4):PRINT M(5):PRINT M(6):PRINT M(7):PRINT M(8):PRINT T$:PRINT MA
15084 PRINT CHR$(4);"CLOSE";F$+".INDEX"

15086 PRINT CHR$(4);"OPEN";F$+".BITMAP"
15088 PRINT CHR$(4);"WRITE";F$+".BITMAP" 
15090 FOR I=1 TO 19
15092 FOR J=1 TO 79
15093 PRINT B(I,J);
15094 NEXT J
15095 PRINT
15096 NEXT I
15097 PRINT CHR$(4);"CLOSE";F$+".BITMAP"

15098 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL
15099 GOTO 60

15100 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL
15105 INVERSE:VTAB 23:HTAB 50:PRINT"LOADING":NORMAL
15106 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60

15108 REM 

15110 REM PRINT CHR$(4);"OPEN";F$
15120 PRINT CHR$(4);"READ";F$ 
15130 FOR I=1 TO 19
15140 FOR J=1 TO 79
15150 INPUT B(I,J)
15160 NEXT J
15170 NEXT I
15180 PRINT CHR$(4);"CLOSE";F$
15181 REM PRINT CHR$(4);"OPEN";F$+".INDEX"
15182 PRINT CHR$(4);"READ";F$+".INDEX"
15183 INPUT X1:INPUT Y1:INPUT X9:INPUT Y9:INPUT V8:INPUT V9:INPUT G1:INPUT M(1):INPUT M(2):INPUT M(3):INPUT M(4):INPUT M(5):INPUT M(6):INPUT M(7):INPUT M(8):INPUT T$:INPUT MA
15184 PRINT CHR$(4);"CLOSE";F$+".INDEX"
15185 IF M(5)=0 THEN FOR I=1 TO 8:M(I)=I:NEXT I:T$="R  DR  D  DL  L  UL  U  UR "

15186 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL
15187 GOSUB 15200


15188 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL
15190 IF G1=0 THEN RN=1:GOSUB 41000


15196 NORMAL:VTAB 20:HTAB 44:PRINT"                "

15197 IF MA=1 THEN C6=0:NORMAL:VTAB 21:HTAB 15:PRINT"        "



15198 LL=1:GOSUB 1200:GOTO 60

15200 BB=0:VTAB 20:HTAB 75:PRINT"    ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0" 
15202 FOR I=1 TO 19
15210 FOR J=1 TO 79
15220 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1:GOSUB 1200
15222 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
15230 NEXT J
15240 NEXT I
15250 RETURN

15500 NORMAL:VTAB 20:HTAB 44:PRINT"                ":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL

15502 FOR I=1 TO 19
15510 FOR J=1 TO 79
15520 VTAB I:HTAB J:PRINT" "
15530 NEXT J
15540 NEXT I

15542 FOR I=0 TO 20
15543 FOR J=0 TO 80
15544 B(I,J)=0
15545 NEXT J
15546 NEXT I

15548 BB=0
15549 VTAB 20:HTAB 75:PRINT"   0":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0"
15550 GOTO 60

15800 HOME
15802 PRINT CHR$(4);"CATALOG"+",D2,S6"
15810 PRINT:PRINT"<PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$
15820 HOME:BB=0
15830 FOR I=1 TO 19
15840 FOR J=1 TO 79
15850 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1
15860 NEXT J
15870 NEXT I

15880 IF D2=1 THEN D2=0:RETURN

15990 GOTO 52


18000 HOME
18006 GOSUB 20040
18820 HOME:BB=0
18830 FOR I=1 TO 19
18840 FOR J=1 TO 79
18850 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1
18860 NEXT J
18870 NEXT I
18990 GOTO 52


20000 PRINT:PRINT:PRINT
20010 PRINT"                               MOUSE & MAZE"
20020 PRINT"                          DESIGNED BY TIMOTHY WEN"
20030 PRINT"                            09/2008 PD SOFTWARE"

20032 PRINT:PRINT:PRINT:PRINT"                       <PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$

20040 HOME
20050 PRINT"COMMAND :"
20060 PRINT
20070 PRINT"           I,J,K,M      ADD ELEMENT OF WALL TO BUILD MAZE."
20080 REM PRINT
20090 PRINT"           Y,G,H,B      DELETE ELEMENT OF WALL TO BUILD MAZE."

20092 PRINT
20094 PRINT"           ^Y,^G,^H,^B  JUST MOVE CURSOR,NO ADDING OR DELETING ELEMENT OF WALL."
20096 PRINT"                        (^ MEANS <CTRL> KEY)"
20110 PRINT
20120 PRINT"           R            BEGIN TO RUN THE MOUSE.(SET MODE ONLY)"
20150 REM PRINT
20160 PRINT"           Q            QUIT THE PROGRAM."
20170 REM PRINT
20180 PRINT"           S            SAVE MAZE PATTERN."
20190 REM PRINT
20200 PRINT"           L            LOAD MAZE PATTERN."
20210 REM PRINT
20220 PRINT"           C            CLEAR DESIGNING AREA."
20230 REM PRINT
20240 PRINT"           X            SHOW THE SAVED MAZE FILES."
20241 REM PRINT
20242 PRINT"           O            SHOW THE COMMAND HELP PAGE."
20243 REM PRINT
20244 PRINT"           U            CLEAR SHORTCUT AND OPTIMIZE ROUTE."

20250 PRINT:PRINT:PRINT:PRINT:PRINT"                       <PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$


20260 HOME
20262 PRINT
20270 PRINT"          ^F            IF YOU CAN'T LOAD THE MAZE OF OLD VERSION,"
20272 PRINT"                        TRY THIS FUNCTION."
20280 REM PRINT
20290 PRINT"          ^O            CHANGE ORIGINAL POSITION OF THE MOUSE."
20300 REM PRINT
20310 PRINT"          ^T            CHANGE TARGET POSITION OF THE MOUSE."
20320 REM PRINT
20330 PRINT"          ^R            RETURN TO COMMON MODE."
20332 PRINT"                        (TARGETS ARE THE EDGES OF DESIGNING AREA.)"
20340 REM PRINT
20350 PRINT"          ^Z            SET RUNNING RULES OF MOUSE BY YOURSELF."
20360 REM PRINT

20380 REM PRINT
20390 PRINT" "
20400 REM PRINT
20410 PRINT" "

20420 PRINT:PRINT:PRINT:PRINT:PRINT"                       <PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$








20990 RETURN


21000 FOR I=1 TO 19
21010 FOR J=1 TO 79
21020 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
21030 NEXT J
21040 NEXT I
21050 RETURN

22200 INVERSE:VTAB 23:HTAB 50:PRINT"ERROR OCCURED":NORMAL:FOR I=1 TO 50000:NEXT I:GOTO 60

26000 NORMAL
26002 FOR I=1 TO 19
26010 FOR J=1 TO 79
26020 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
26030 NEXT J
26040 NEXT I
26050 RETURN


27000 S1=S1+1:N1=21:N2=78
27010 IF S1>9 THEN N2=N2-1
27020 IF S1>99 THEN N2=N2-1
27030 IF S1>999 THEN N2=N2-1
27040 VTAB N1:HTAB N2: PRINT S1
27050 RETURN


28000 IF R1>8 THEN RETURN
28010 INVERSE:VTAB 23:HTAB 66:PRINT"ROOT PASS : ";R1:NORMAL
28020 RETURN

29000 IF X1=X9 AND Y1=Y9 THEN 29040
29010 IF B(X1,Y1)=1 THEN NORMAL:VTAB X1:HTAB Y1:PRINT"$"
29020 IF B(X1,Y1)=0 THEN NORMAL:VTAB X1:HTAB Y1:PRINT" "
29030 IF X2=X9 AND Y2=Y9 THEN 29050
29040 INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
 

29050 RETURN

30000 O1=O1+1
30004 X8=10:Y8=40
30006 IF O1>1 THEN X8=X9:Y8=Y9
30007 IF LL=1 THEN X8=X9:Y8=Y9
30008 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        CHANGE ORIGINAL POSITION      ":NORMAL
30010 INVERSE:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL


30050 IF A$=CHR$(25) THEN X9=X8-1:Y9=Y8:GOSUB 62300
30060 IF A$=CHR$(7) THEN X9=X8:Y9=Y8-1:GOSUB 62300
30070 IF A$=CHR$(8) THEN X9=X8:Y9=Y8+1:GOSUB 62300
30080 IF A$=CHR$(2) THEN X9=X8+1:Y9=Y8:GOSUB 62300

30082 IF A$=CHR$(15) THEN 36000

30090 GOTO  30010




31000 IF B(X8,Y8)=1 THEN NORMAL:VTAB X8:HTAB Y8:PRINT"$"
31010 IF B(X8,Y8)=0 THEN NORMAL:VTAB X8:HTAB Y8:PRINT" "

31012 IF X8=V8 AND Y8=V9 AND G1>0 THEN NORMAL:VTAB V8:HTAB V9:PRINT"T"
31014 IF X8=X1 AND Y8=Y1 THEN INVERSE:VTAB X1:HTAB Y1:PRINT"$":NORMAL

31020 NORMAL:VTAB X9:HTAB Y9:PRINT"M"

31050 RETURN

32000 IF X9<1 THEN X9=19
32010 IF X9>19 THEN X9=1
32020 IF Y9<1 THEN Y9=79
32030 IF Y9>79 THEN Y9=1

32040 RETURN



33000 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                              ":VTAB 23:HTAB 50:PRINT"MAZE FIXING":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL

33002 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60

33010 A9=10:B9=40:C8=10:D9=38:E1=0:FF=1

33012 N(1)=1:N(2)=2:N(3)=3:N(4)=4:N(5)=5:N(6)=6:N(7)=7:N(8)=8

33014 H$="R  DR  D  DL  L  UL  U  UR "

33016 REM 

33081 REM PRINT CHR$(4);"OPEN";F$+".INDEX"
33082 PRINT CHR$(4);"READ";F$+".INDEX"
33083 INPUT T1:INPUT T2
33084 PRINT CHR$(4);"CLOSE";F$+".INDEX"


33181 PRINT CHR$(4);"OPEN";F$+".INDEX"
33182 PRINT CHR$(4);"WRITE";F$+".INDEX"
33183 PRINT T1:PRINT T2:PRINT A9:PRINT B9:PRINT C8:PRINT D9:PRINT E1:PRINT N(1):PRINT N(2):PRINT N(3):PRINT N(4):PRINT N(5):PRINT N(6):PRINT N(7):PRINT N(8):PRINT H$:PRINT FF
33184 PRINT CHR$(4);"CLOSE";F$+".INDEX"

33186 INVERSE:VTAB 23:HTAB 50:PRINT"           ":VTAB 23:HTAB 12:PRINT"                              ":NORMAL

33190 GOTO 60



34000 G1=G1+1
34002 G8=10:G9=38

34003 IF G1>1 OR LL=1 THEN G8=V8:G9=V9:NORMAL:VTAB G8:HTAB G9:PRINT"T":GOTO 34007


34004 NORMAL:VTAB G8:HTAB G9:PRINT"T"

34005 REM IF G1>1 THEN G8=V8:G9=V9:NORMAL:VTAB G8:HTAB G9:PRINT"T"
34006 REM IF LL=1 THEN G8=V8:G9=V9:NORMAL:VTAB G8:HTAB G9:PRINT"T"



34007 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        CHANGE TARGET POSITION        ":NORMAL
34010 INVERSE:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

34050 IF A$=CHR$(25) THEN V8=G8-1:V9=G9:GOSUB 62400
34060 IF A$=CHR$(7) THEN V8=G8:V9=G9-1:GOSUB 62400
34070 IF A$=CHR$(8) THEN V8=G8:V9=G9+1:GOSUB 62400
34080 IF A$=CHR$(2) THEN V8=G8+1:V9=G9:GOSUB 62400

34082 IF A$=CHR$(20) THEN 38000


34090 GOTO  34010


35000 IF B(G8,G9)=1 THEN NORMAL:VTAB G8:HTAB G9:PRINT"$"
35010 IF B(G8,G9)=0 THEN NORMAL:VTAB G8:HTAB G9:PRINT" "

35012 IF G8=X9 AND G9=Y9 THEN NORMAL:VTAB X9:HTAB Y9:PRINT"M"
35014 IF G8=X1 AND G9=Y1 THEN INVERSE:VTAB X1:HTAB Y1:PRINT"$":NORMAL


35020 NORMAL:VTAB V8:HTAB V9:PRINT"T"

35050 RETURN


36000 IF B(X9,Y9)=1 THEN INVERSE:VTAB 23:HTAB 50:PRINT"STAND ON THE DOLLAR SIGN":GOTO 30010
36001 IF V8=10 AND V9=38 THEN 36010
36002 IF X9=V8 AND Y9=V9 THEN INVERSE:VTAB 23:HTAB 50:PRINT"M STAND ON T            ":GOTO 30010
36010 INVERSE:VTAB 23:HTAB 50:PRINT"                        ":NORMAL:GOTO 60

37000 IF V8<1 THEN V8=19
37010 IF V8>19 THEN V8=1
37020 IF V9<1 THEN V9=79
37030 IF V9>79 THEN V9=1

37040 RETURN


38000 IF B(V8,V9)=1 THEN INVERSE:VTAB 23:HTAB 50:PRINT"STAND ON THE DOLLAR SIGN":GOTO 34010
38002 IF X9=V8 AND Y9=V9 THEN INVERSE:VTAB 23:HTAB 50:PRINT"T STAND ON M            ":GOTO 34010
38010 INVERSE:VTAB 23:HTAB 50:PRINT"                        ":NORMAL:GOTO 60


40000 NORMAL:VTAB V8:HTAB V9:PRINT"T"

40002 FOR I=0 TO 80

40010 B(0,I)=1:B(20,I)=1
40020 NEXT I

40030 FOR J=0 TO 20
40040 B(J,0)=1:B(J,80)=1
40050 NEXT J


40090 RETURN

 
41000 IF RN=1 THEN 41006

41001 IF B(V8,V9)=1 THEN B(V8,V9)=0:BB=BB-1:GOSUB 1200 

41002 NORMAL:VTAB V8:HTAB V9:PRINT" ":G1=0:V8=10:V9=38

41006 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

41008 FOR I=0 TO 80

41010 B(0,I)=0:B(20,I)=0
41020 NEXT I

41030 FOR J=0 TO 20
41040 B(J,0)=0:B(J,80)=0
41050 NEXT J

41060 IF RN=1 THEN RN=0:RETURN
41090 GOTO 64


43000 IN=1:PO=0:CH=1:MA=1:T$=""
43002 CU$(8)="UR ":CU$(1)=" R ":CU$(2)="DR ":CU$(3)=" D ":CU$(4)="DL ":CU$(5)=" L ":CU$(6)="UL ":CU$(7)=" U "


43004 INVERSE:VTAB 23:HTAB 1:PRINT"RULES :                                          ":NORMAL

43006 VTAB 23:HTAB 15:PRINT CU$(IN)

43008 INVERSE:VTAB 23:HTAB 9:GET A$:GOSUB 60000:VTAB 23:HTAB 9:PRINT A$:NORMAL



43010 IF A$="J" THEN IN=IN-1:GOTO 43100
43020 IF A$="K" THEN IN=IN+1:GOTO 43100
43022 IF A$="M" AND PO<7 THEN T$=T$+CU$(IN)+" ":PO=PO+1:M(CH)=IN:CH=CH+1:IN=1:GOTO 43150
43023 IF A$="M" AND PO=7 THEN T$=T$+CU$(IN)+" ":GOTO 44000

43030 IF A$=CHR$(43) THEN 46000

43050 GOTO 43008

43100 INVERSE:VTAB 23:HTAB 50:PRINT"             ":NORMAL

43102 IF IN>8 THEN IN=1
43110 IF IN<1 THEN IN=8


43150 VTAB 23:HTAB 15+PO*4:PRINT CU$(IN)

43160 GOTO 43008


44000 REM 

44002 M(CH)=IN
44010 REM TT=1

44130 FOR I=1 TO CH-1
44131 FOR J=2 TO CH
44132 IF I=J THEN 44134
44133 IF M(I)=M(J) THEN 45000
44134 NEXT J
44136 NEXT I
 

44140 REM PO=PO+1:M(CH)=IN:CH=CH+1

44150 INVERSE:VTAB 23:HTAB 1:PRINT"                                                  "

44160 GOTO 60


45000 INVERSE:VTAB 23:HTAB 50:PRINT"RULE REPEATED":NORMAL
45010 GOTO 43000


46000 T$="R  DR  D  DL  L  UL  U  UR "

46002 FOR I=1 TO 8
46010 M(I)=I
46020 NEXT I

46030 GOTO 44150


60000 IF A$=CHR$(10) OR A$=CHR$(13) OR A$=CHR$(22) OR A$=CHR$(12) OR A$=CHR$(11) OR A$=CHR$(17) OR A$=CHR$(23) OR A$=CHR$(21) OR A$=CHR$(27) THEN A$=" "
60002 RETURN
   

62000 GOSUB 1000:GOSUB 29000:X1=X2:Y1=Y2
62010 RETURN

62100 GOSUB 1000:INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL:VTAB X1:HTAB Y1:PRINT"$":GOSUB 1100:B(X1,Y1)=1:GOSUB 1200:X1=X2:Y1=Y2
62110 RETURN

62200 GOSUB 1000:INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL:VTAB X1:HTAB Y1:PRINT" ":GOSUB 1150:B(X1,Y1)=0:GOSUB 1200:X1=X2:Y1=Y2
62210 RETURN


62300 GOSUB 32000:GOSUB 31000:X8=X9:Y8=Y9
62310 RETURN

62400 GOSUB 37000:GOSUB 35000:G8=V8:G9=V9
62410 RETURN










 